<%--
  Created by IntelliJ IDEA.
  User: 陈俊雄
  Date: 2018/5/7
  Time: 14:34
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<div class="modal-header">
    <button class="close" ng-click="cancel()">
        <span aria-hidden="true">×</span>
    </button>
    <h3 class="modal-title" id="modal-title">{{ type == 0 ? '添加收单机构' : '修改收单机构'}}</h3>
</div>
<div class="modal-body" id="modal-body">
    <form name="myForm" class="form-horizontal">
        <div class="ibox-content no-borders tab-content">
            <uib-tabset active="activeForm">
                <uib-tab index="0" classes="m-b">
                    <uib-tab-heading><i class="fa fa-user"></i>&nbsp;基本信息</uib-tab-heading>
                    <div class="form-group  m-t">
                        <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>名称：</label>
                        <div class="col-sm-10">
                            <input class="form-control b-r-sm" name="name" type="text" placeholder="必填"
                                   ng-model="acquirerInfo.name" ng-blur="nameBlur($event, acquirerInfo.name)" required>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>类型：</label>
                        <div class="col-sm-10">
                            <select class="form-control b-r-sm" name="type" ng-model="acquirerInfo.type"
                                    ng-blur="typeBlur($event, acquirerInfo.type)" required
                                    ng-options="x.firstValue as x.name for x in acquirerType">
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>状态：</label>
                        <div class="col-sm-10">
                            <select class="form-control b-r-sm" name="status" ng-model="acquirerInfo.status"
                                    ng-blur="statusBlur($event, acquirerInfo.status)"
                                    ng-options="+(x.firstValue) as x.name for x in acquirerStatus"
                                    required>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>银行：</label>
                        <div class="col-sm-10">
                            <select class="form-control b-r-sm" name="bankId" ng-model="acquirerInfo.bankId"
                                    ng-blur="bankIdBlur($event, acquirerInfo.bankId)"
                                    ng-options="x.id as x.name for x in bank" required>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>支付地址：</label>
                        <div class="col-sm-10">
                            <input class="form-control b-r-sm" name="url" type="text" placeholder="必填"
                                   ng-model="acquirerInfo.url" ng-blur="urlBlur(acquirerInfo.url)" required>
                        </div>
                    </div>
                </uib-tab>
                <uib-tab index="1" disable="nextDisabled(myForm, 0)">
                    <uib-tab-heading><i class="fa fa-address-card"></i>&nbsp;币种与风控</uib-tab-heading>
                    <div class="form-group m-t">
                        <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>支持币种：</label>
                        <div class="col-sm-10 clearfix">
                            <div class="col-sm-4 p-w-xs" ng-repeat="x in currency">
                                <div class="checkbox no-margins">
                                    <input id="{{x.firstValue}}" type="checkbox" name="currency"
                                           ng-model="acquirerInfo.currency[x.firstValue]"
                                           ng-checked="exists(x.firstValue, acquirerInfo.currency)"
                                           ng-click="toggle(x.firstValue, acquirerInfo.currency)"
                                           ng-required="!someSelected(acquirerInfo.currency)">
                                    <label for="{{x.firstValue}}" class="no-padding">{{x.name}}</label>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label p-w-xs">支持风控：</label>
                        <div class="col-sm-10 clearfix">
                            <div class="col-sm-4 p-w-xs" ng-repeat="x in risk">
                                <div class="checkbox no-margins">
                                    <input id="{{x.firstValue}}" type="checkbox"
                                           ng-checked="exists(x.firstValue, acquirerInfo.risk)"
                                           ng-click="toggle(x.firstValue, acquirerInfo.risk)">
                                    <label for="{{x.firstValue}}" class="no-padding">{{x.name}}</label>
                                </div>
                            </div>
                        </div>
                    </div>
                </uib-tab>
                <uib-tab index="2" disable="nextDisabled(myForm, 1)">
                    <uib-tab-heading><i class="fa fa-users"></i>&nbsp;支付方式</uib-tab-heading>
                    <div class="form-group m-t">
                        <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>支付方式：</label>
                        <div class="col-sm-10 clearfix">
                            <div class="col-sm-4 p-w-xs" ng-repeat="x in payMode">
                                <div class="radio no-margins">
                                    <input id="{{x.firstValue}}" type="radio" value="{{x.firstValue}}" name="payMode"
                                           ng-model="acquirerInfo.payMode" ng-required="!acquirerInfo.payMode">
                                    <label for="{{x.firstValue}}" class="no-padding">{{x.name}}</label>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>扣率：</label>
                        <div class="col-sm-10" ng-show="acquirerInfo.payMode == null">
                            <input class="form-control b-r-sm text-danger" type="text" value="请选择支付方式！"
                                   ng-disabled="true">
                        </div>
                        <div class="col-sm-10 clearfix">
                            <div class="p-w-xs" ng-repeat="x in payType">
                                <div class="clearfix">
                                    <div class="checkbox no-margins col-sm-4">
                                        <input id="{{x.firstValue}}" type="checkbox" value="{{x.firstValue}}"
                                               ng-checked="exists(x.firstValue, acquirerRate.payType)"
                                               ng-click="toggle(x.firstValue, acquirerRate.payType)">
                                        <label for="{{x.firstValue}}" class="no-padding">{{x.name}}</label>
                                    </div>
                                    <div class="col-sm-8">
                                        <input class="form-control input-sm" type="number" ng-model="x.rate">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>支付页面：</label>
                        <div class="col-sm-10">
                            <select class="form-control b-r-sm" ng-model="acquirerInfo.payPage"
                                    ng-blur="payPageBlur($event, acquirerInfo.payPage)" required
                                    ng-options="x.firstValue as x.name for x in payPage">
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>优先范围：</label>
                        <div class="col-sm-10">
                            <select class="form-control b-r-sm" ng-model="acquirerInfo.scope"
                                    ng-blur="scopeBlur($event, acquirerInfo.scope)" required
                                    ng-options="x.firstValue as x.name for x in continent">
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label p-w-xs">备注：</label>
                        <div class="col-sm-10">
                <textarea class="form-control b-r-sm" ng-model="acquirerInfo.remark"
                          style="resize: none;height: 100px"></textarea>
                        </div>
                    </div>
                </uib-tab>
            </uib-tabset>


            <%--<div class="form-group">
                <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>名称：</label>
                <div class="col-sm-10">
                    <input class="form-control b-r-sm" type="text" placeholder="必填"
                           ng-model="acquirerInfo.name"
                           ng-blur="nameBlur($event, acquirerInfo.name)"
                           ng-keyup="nameKeyUp($event, acquirerInfo.name)" required>
                    <span class="help-block" ng-show="nameMessage != null">{{nameMessage}}</span>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>类型：</label>
                <div class="col-sm-10">
                    <select class="form-control b-r-sm" ng-model="acquirerInfo.type"
                            ng-blur="typeBlur($event, acquirerInfo.type)" required
                            ng-options="x.firstValue as x.name for x in acquirerType">
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>状态：</label>
                <div class="col-sm-10">
                    <select class="form-control b-r-sm" ng-model="acquirerInfo.status"
                            ng-blur="statusBlur($event, acquirerInfo.status)" required
                            ng-options="x.firstValue as x.name for x in acquirerStatus">
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>银行：</label>
                <div class="col-sm-10">
                    <select class="form-control b-r-sm" ng-model="acquirerInfo.bankId"
                            ng-blur="bankIdBlur($event, acquirerInfo.bankId)" required
                            ng-options="x.id as x.name for x in bank">
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>支持币种：</label>
                <div class="col-sm-10 clearfix">
                    <div class="col-sm-4 p-w-xs" ng-repeat="x in currency">
                        <div class="checkbox no-margins">
                            <input id="{{x.firstValue}}" type="checkbox" ng-model="acquirerInfo.currency[x.firstValue]"
                                   ng-checked="exists(x.firstValue, acquirerInfo.currency)"
                                   ng-click="toggle(x.firstValue, acquirerInfo.currency)"
                                   ng-required="!someSelected(acquirerInfo.currency)">
                            <label for="{{x.firstValue}}" class="no-padding">{{x.name}}</label>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label p-w-xs">支持风控：</label>
                <div class="col-sm-10 clearfix">
                    <div class="col-sm-4 p-w-xs" ng-repeat="x in risk">
                        <div class="checkbox no-margins">
                            <input id="{{x.firstValue}}" type="checkbox"
                                   ng-checked="exists(x.firstValue, acquirerInfo.risk)"
                                   ng-click="toggle(x.firstValue, acquirerInfo.risk)">
                            <label for="{{x.firstValue}}" class="no-padding">{{x.name}}</label>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>支付页面：</label>
                <div class="col-sm-10">
                    <select class="form-control b-r-sm" ng-model="acquirerInfo.payPage"
                            ng-blur="payPageBlur($event, acquirerInfo.payPage)" required
                            ng-options="x.firstValue as x.name for x in payPage">
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>优先范围：</label>
                <div class="col-sm-10">
                    <select class="form-control b-r-sm" ng-model="acquirerInfo.scope"
                            ng-blur="scopeBlur($event, acquirerInfo.scope)" required
                            ng-options="x.firstValue as x.name for x in continent">
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>支付方式：</label>
                <div class="col-sm-10 clearfix">
                    <div class="col-sm-4 p-w-xs" ng-repeat="x in payMode">
                        <div class="radio no-margins">
                            <input id="{{x.firstValue}}" type="radio" value="{{x.firstValue}}"
                                   ng-model="acquirerInfo.payMode" ng-required="!acquirerInfo.payMode">
                            <label for="{{x.firstValue}}" class="no-padding">{{x.name}}</label>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>扣率：</label>
                <div class="col-sm-10" ng-show="acquirerInfo.payMode == null">
                    <input class="form-control b-r-sm text-danger" type="text" value="请选择支付方式！" ng-disabled="true">
                </div>
                <div class="col-sm-10 clearfix">
                    <div class="p-w-xs" ng-repeat="x in payType">
                        <div class="clearfix">
                            <div class="checkbox no-margins col-sm-4">
                                <input id="{{x.firstValue}}" type="checkbox" value="{{x.firstValue}}"
                                       ng-checked="exists(x.firstValue, acquirerRate.payType)"
                                       ng-click="toggle(x.firstValue, acquirerRate.payType)">
                                <label for="{{x.firstValue}}" class="no-padding">{{x.name}}</label>
                            </div>
                            <div class="col-sm-8">
                                <input class="form-control input-sm" type="number" ng-model="x.rate">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label p-w-xs"><span class="text-danger">*</span>支付地址：</label>
                <div class="col-sm-10">
                    <input class="form-control b-r-sm" type="text" placeholder="必填"
                           ng-model="acquirerInfo.url" ng-blur="urlBlur(acquirerInfo.url)"
                           ng-keyup="urlKeyUp(acquirerInfo.url)" required>
                    <span class="help-block" ng-show="urlMessage!=''">{{urlMessage}}</span>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label p-w-xs">备注：</label>
                <div class="col-sm-10">
                <textarea class="form-control b-r-sm" ng-model="acquirerInfo.remark"
                          style="resize: none;height: 100px"></textarea>
                </div>
            </div>--%>
        </div>
    </form>
    <div class="row">
        <div class="col-sm-12">
            <div class="center">
                <button class="btn btn-sm" type="button" ng-click="confirm(acquirerInfo, activeForm)"
                        ng-class="{'btn-primary': activeForm != 2, 'btn-success': activeForm == 2}"
                        ng-disabled="nextDisabled(myForm, activeForm)">
                    {{activeForm != 2 ? '下一步' : '确定'}}
                </button>
            </div>
        </div>
    </div>
</div>